<?php

defined('BY_JYA') or exit('error');
list($card_id)=$arguments;
		$id = intval($card_id);

		if (!empty($id)) {
			$sql = 'select id,uniacid, card_id from ' . tablename('jy_weishop_wxcard');
			$sql .= '  where uniacid=:uniacid and id=:id   limit 1';
			$wxcard = pdo_fetch($sql, array(':id' => $id, ':uniacid' => $_SESSION['uniacid']['uniacid']));
			if (empty($wxcard) || empty($wxcard['card_id'])) {
				return false;
			}

			$card_id = $wxcard['card_id'];
		}
		else {
			$sql = 'select id,uniacid, card_id from ' . tablename('jy_weishop_wxcard');
			$sql .= '  where uniacid=:uniacid and card_id=:card_id   limit 1';
			$wxcard = pdo_fetch($sql, array(':card_id' => $card_id, ':uniacid' => $_SESSION['uniacid']['uniacid']));
			if (empty($wxcard) || empty($wxcard['card_id'])) {
				return false;
			}

			$card_id = $wxcard['card_id'];
			$id = $wxcard['id'];
		}

		$result = $this->wxcard__getquantity($card_id);

		if (empty($result)) {
			return false;
		}

		$data = array('quantity' => intval($result['quantity']), 'total_quantity' => intval($result['total_quantity']));
		pdo_update('jy_weishop_wxcard', $data, array('id' => $id));
		return true;
